package com.example.admin.midtermpro41;

import android.util.Log;

import java.util.List;
/*这是英雄属性相关的类*/
public class hero {
    /*属性*/
    public int headPortraitID;//头像ID
    public int heroBackgroundID;//背景ID
    public String heroName;//名字
    public String heroPosition;//定位
    public double heroViability;//生命值
    public double heroATK;//攻击伤害值
    public double heroDEF;//防御值
    public double heroPower;//法力值
    public static hero[] heroes;


    hero(){
        headPortraitID=R.mipmap.ic_launcher;
        heroBackgroundID=R.drawable.ic_launcher_background;
        heroATK= 0;
        heroName="not found";
        heroViability=0;
        heroPosition="not found";
        heroDEF=0;
        heroPower=0;
    }
    hero( int headPortraitID,int heroBackgroundID,String heroName ,double heroViability,
          double heroPower,double heroATK, double heroDEF,String heroPosition
    ){
        this.headPortraitID=headPortraitID;
        this.heroBackgroundID=heroBackgroundID;
        this.heroName=heroName;
        this.heroViability=heroViability;
        this.heroPower=heroPower;
        this.heroATK=heroATK;
        this.heroDEF=heroDEF;
        this.heroPosition=heroPosition;
    }
    public static hero getHeroByName(String name){
        for(int i=0;i<MainActivity.heroes.length;i++){
            if(name.equals(MainActivity.heroes[i].heroName)){
                return MainActivity.heroes[i];
            }
        }
        Log.i("debug","hero not found");
        return new hero();
    }
    public static boolean searchHeroIsInHeroListOrNot(String name){
        for(int i=0;i<MainActivity.heroList[0].size();i++){
            if(name.equals(MainActivity.heroList[0].get(i).heroName)){
                return true;
            }
        }
        return false;
    }


    //heroList[0]用于存储所有的英雄信息
    public static void initHeroList(List<hero>[] heroList){
        hero[] heroes={new hero(R.mipmap.an_qi_la_icon,R.drawable.an_qi_la,"安琪拉" ,3323,	490,170,83,"法师"),
                new hero(R.mipmap.bai_li_shou_yue_icon,R.drawable.bai_li_shou_yue,"百里守约"	,3019,440,188,94,"射手"),
                new hero(R.mipmap.bai_li_xuan_ce_icon,R.drawable.bai_li_xuan_ce,"百里玄策",3359,450,178,88,"刺客"),
                new hero(R.mipmap.bian_que_icon,R.drawable.bian_que,"扁鹊",3205,490,168,87,"法师"),
                new hero(R.mipmap.bu_zhi_huo_wu_icon,R.drawable.bu_zhi_huo_wu,"不知火舞",3235,	200	,170,	89,	"法师"),
                new hero(R.mipmap.cai_wen_ji_icon,R.drawable.cai_wen_ji,"蔡文姬",3238,	470,	159,	96,"辅助"),
                new hero(R.mipmap.cao_cao_icon,R.drawable.cao_cao,"曹操",3467,0,174,104,"战士"),
                new hero(R.mipmap.cheng_ji_si_han_icon,R.drawable.cheng_ji_si_han,"成吉思汗",3027,	440,	184,	94,"射手"),
                new hero(R.mipmap.cheng_yao_jin_icon,R.drawable.cheng_yao_jin,"程咬金",3437,0	,161,	125,	"坦克"),
                new hero(R.mipmap.da_mo_icon,R.drawable.da_mo,"达摩",	3213,	420,	171,	95,	"战士"),
                new hero(R.mipmap.da_qiao_icon,R.drawable.da_qiao,"大乔",2958,	470,	168,	93,	"辅助"),
                new hero(R.mipmap.di_ren_jie_icon,R.drawable.di_ren_jie,"狄仁杰"	,3242,	440,	169,	95,	"射手"),
                new hero(R.mipmap.dian_wei_icon,R.drawable.dian_wei,"典韦"	,3434,	430,	168,	89,	"战士"),
                new hero(R.mipmap.diao_chan_icon,R.drawable.diao_chan,"貂蝉"	,3019	,490,	167,	87,	"法师"),
                new hero(R.mipmap.dong_huang_tai_yi_icon,R.drawable.dong_huang_tai_yi,"东皇太一",3201,470,163,99,"坦克")
        };
        MainActivity.heroes=heroes;
        for(int i=0;i<heroes.length;i++){
            heroList[0].add(heroes[i]);
        }

        Log.i("debug","initHeroList");
    }


}
